<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderSpecificationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_specifications', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order_id')->unsgined()->comment('订单 ID')->index();
            $table->integer('goods_id')->unsigned()->comment('商品 ID')->index();
            $table->integer('amount')->unsigned()->comment('数量');
            $table->decimal('original_price', 10, 2)->comment('生成订单时的结算原始价格，该价格可在订单确认阶段调整');
            $table->decimal('price_strategy')->comment('订单生成时的价格策略');
            $table->string('goods_spec_information')->comment('生成订单时的规格信息，以 JSON 格式保存');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('order_specifications');
    }
}
